package com.wugenqiang.testssl;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.*;

@RestController
@SpringBootApplication
@RequestMapping(value = "/pki-validation")
public class TestSslApplication {

    String s = "";
    public static void main(String[] args) {
        SpringApplication.run(TestSslApplication.class, args);
    }

    @RequestMapping(value = "/fileauth.txt")
    String out() throws IOException {

        ClassPathResource resource = new ClassPathResource("fileauth.txt");
        File file;
        file = resource.getFile();

        BufferedReader br;

        br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));


        StringBuffer content = new StringBuffer();
        while ((s=br.readLine())!=null){
            content = content.append(s);
        }
        return content.toString();
    }

    /*@RequestMapping(value = "/",produces = "text/plain;charset=UTF-8")
    String index(String content) throws IOException {
        return content;
    }*/

}
